1. Field of the Invention
The present invention relates to an imaging apparatus, an imaging method, and an imaging program capable of adaptively correcting image data and also to an image processing apparatus, an image processing method, and an image processing program capable of adaptively correction image data.
2. Description of the Related Art
A digital camera is widely used which allows it to take an image by sensing light from a subject using an image sensor such as a CCD (Charge Coupled Device), processing an image signal output from the image sensor, and storing digital image data obtained as a result of the signal processing into a storage medium such as a semiconductor memory. Many digital cameras have a capability that allows a user to perform various kinds of image processing such as edge enhancement, contrast correction, color correction, etc. on image data taken using the digital camera.
The digital camera also has a capability, as one of various kinds of image processing, of correcting the relative relationship between an input signal and an output signal (hereinafter, the correction will be referred to as the input-output characteristic correction). The input-output characteristic correction allows it to improve image quality of an image taken by the digital camera. For example, an image whose luminance distribution is concentrated about a particular luminance level over the entire area of the image and thus whose contrast is low can be corrected so as to have high contrast. When an image is taken against light, the resultant image is generally dark in an area of a main subject and light in a peripheral area. The input-output characteristic correction allows such an image to be corrected so as to increase the brightness of the main subject area and decrease the brightness of the peripheral area.
With reference to FIGS. 19 and 20, the input-output characteristic correction is further described. FIGS. 19A and 19B show an example of a tone correction (by an input-output characteristic correction) applied to an image whose luminance distribution is concentrated about a particular luminance level over the entire area of the image and thus whose contrast is low. FIG. 19A shows an example of a histogram of luminance of such a type of image. In FIG. 19A, a horizontal axis represents luminance and a vertical axis represents the frequency of luminance of pixels over the entire area of the image. The luminance histogram of the original uncorrected image is represented by a solid line x. In this example, the original image has a luminance distribution concentrated about a particular level in a middle range and thus has low contrast.
FIG. 19B shows an example of a luminance input-output characteristic curve (also referred to as a tone curve) used to correct the image data having the luminance distribution represented by the solid line x in FIG. 19A. As shown in FIG. 19B, the tone curve G used for the present purpose is concave in a low luminance range of the input signal and is convex in a high luminance range, that is, the tone curve G has an S-like shape. The application of this tone curve G causes the luminance in the low range to become lower and the luminance in the high range to become higher as represented by a broken line y in FIG. 19A, and thus the contrast of the image is improved.
FIGS. 20A and 20B show an example of an input-output characteristic correction for an image taken against light. FIG. 20A shows an example of a histogram of luminance of such a type of image. As represented by a solid line x in FIG. 20A, the original uncorrected image has a luminance distribution concentrated in two ranges: a very high luminance range corresponding to an area against light; and a very low luminance range corresponding to a subject illuminated from behind. An image of a subject with such a luminance distribution concentrated in two ranges generally has a dark tone over the entire area of the image, and it is difficult to perceive details of the subject.
FIG. 20B shows an example of a tone curve G usable to make an input-output character correction on image data with a luminance distribution represented by a solid line x in FIG. 20A. As shown in FIG. 20B, the tone curve G used for the present purpose is convex in a low luminance range of the input signal and is concave in a high luminance range, that is, the tone curve G has an S-like shape. In FIG. 20A, a broken line y represents a luminance distribution obtained as a result of the input-output characteristic correction using the tone curve G shown in FIG. 20B. As can be seen, the number of pixels in the low luminance range close to the luminance level of 0 and the number of pixels in the high luminance range close to the luminance level of 255 are decreased, and the number of pixels in the middle luminance range is increased. As a result, the backlight effects are suppressed, and it becomes possible to perceive details of the image.
To properly determine a tone curve, expert knowledge on image data is necessary, and thus it is difficult for general users having no expert knowledge to properly make an input-output characteristic correction. To solve the above problem, some techniques have been proposed which allow it to automatically correct luminance of image data.
For example, in a technique disclosed in Japanese Patent Laid-Open No. 2002-77616, a tone curve used in the input-output characteristic correction is selected according to a feature of luminance histogram of a given image, and the input-output characteristic correction is automatically made according to the selected tone curve. More specifically, in this technique disclosed in Japanese Patent Laid-Open No. 2002-77616, a highlight point, a shadow point, and the degree of balance of a histogram are determined from a histogram of a given image, and a tone curve is selected according to these parameters.
Japanese Patent No. 2874192 discloses a technique to automatically correct exposure for an image including a solid black area due to illumination from behind. More specifically, in this technique, a relatively bright area is detected from a given image based on a signal output from an AGC (Automatic Gain Control) amplifier, the ratio of the bright area to the total area of each block of a camera screen is determined, a determination as to whether a subject is illuminated from front or from behind is made based on the determination result as to the ratio of the bright area, and the AGC and the aperture are controlled by generating a reference signal according to the determination result as to the illumination.
In the above-described technique disclosed in Japanese Patent Laid-Open No. 2002-77616, the tone curve used in the tone correction is switched discontinuously at threshold values of parameters. A sudden change in the tone curve at a threshold value results in a difficulty in precisely controlling the tone correction.
On the other hand, in the technique disclosed in Japanese Patent No. 2874192, when a background area has high luminance, details of the background image are often lost. That is, in the background area, pixel values higher than 100% level in white are forced to be clipped to the 100% level.
Accordingly, it is desirable to provide an imaging apparatus, an imaging method, and an imaging program capable of adaptively correcting image data so as to obtain an image with a natural tone. It is also desirable to provide an image processing apparatus, an image processing method, and an image processing program capable of adaptively correcting image data so as to obtain an image with a natural tone.